/*
	自定义Vue的插件库
*/

(function(window) {
	//需要向外暴露的
	const MyPlugin = {}
	MyPlugin.install = function(Vue, options) {

		// 1. 添加全局方法或属性
		Vue.myGlobalMethod = function() {
			console.log('Vue函数对象的myGlobalMethod()')
		}

		// 2. 添加全局资源
		//定义个指定directive
		Vue.directive('my-directive', function(el, binding) {
			el.textContent = 'my-directive----' + binding.value
		})

		// 4. 添加实例方法
		Vue.prototype.$myMethod = function() {
			console.log('vm $myMethod()')
		}

	}
	window.MyPlugin = MyPlugin
})(window)
